package com.gdyd.boot.controller;

import com.gdyd.boot.bean.City;
import com.gdyd.boot.service.ICityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class CityController {

    @Autowired
    ICityService cityService;

    @RequestMapping("/city")
    public City findCityById(@RequestParam("id") Long id){
        return cityService.findCityById(id);
    }

    @PostMapping("/insertCity")
    public City insertCity(City city){
        cityService.insertCity(city);
        return city;
    }

    @PostMapping("/insertCityByXml")
    public City insertCityByXml(City city){
        cityService.insertCityByXml(city);
        return city;
    }

}
